{% extends 'base_loggedin.html' %}
{% block title %}
{{ block.super }} | New conduit
{% endblock %}
{% block htmlExtraAttrs %}
xmlns:fb="http://www.facebook.com/2008/fbml"
{% endblock %}

{% block block_content %}
<div class="top">
    <p class="left">New conduit</p>
    <p class="right"><a href="{{next}}" title="">Back</a></p>
</div>

<div class="center">

    <form name="newconduit" action="." method="post">
    <input type="hidden" value="{{next}}" name="next" id="id_next"/>

    <ul class="txt full">
        {% if subscriptionError %}
        <li>
        {{ subscriptionError }}
        </li>
        {% endif %}
        {{ form.as_ul }}

        {% for plugin in conduit_plugins %}
            <div id="plugin_{{plugin.key}}_fields" style="display:none">
            {% include plugin.template %}
            </div>
        {% endfor %}
            </ul><br style="clear:both" />
        </li>
        <li>
            <a class="btn2" href="javascript:document.newconduit.submit()" title="">Save conduit</a>
        </li>
    </ul>
    </form>
</div>

<script type="text/javascript">

function onPluginChanged(event) {
    selected = $("#id_plugin").val();

    {% for p in conduit_plugins %}
    if ( selected == "{{ p.key }}") {
        $("#plugin_{{p.key}}_fields").show("fast");
    }
    else {
        $("#plugin_{{p.key}}_fields").hide();
    }
    {% endfor %}
}

$(document).ready(function() {
    $("#id_plugin").change(onPluginChanged);
    $("#id_plugin").change();
});
</script>

{% endblock %}
